package com.mineoj.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mineoj.model.entity.NewsComment;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 题解封装类

 */
@Data
public class NewsCommentVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 新鲜事 id
     */
    private Long newsId;

    /**
     * 内容
     */
    private String content;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 创建用户信息
     */
    private UserVO userVO;


    /**
     * 包装类转对象
     *
     * @param newsVO
     * @return
     */
    public static NewsComment voToObj(NewsCommentVO newsVO) {
        if (newsVO == null) {
            return null;
        }
        NewsComment newsComment = new NewsComment();
        BeanUtils.copyProperties(newsVO, newsComment);

        return newsComment;
    }

    /**
     * 对象转包装类
     *
     * @param newsComment
     * @return
     */
    public static NewsCommentVO objToVo(NewsComment newsComment) {
        if (newsComment == null) {
            return null;
        }
        NewsCommentVO newsVO = new NewsCommentVO();
        BeanUtils.copyProperties(newsComment, newsVO);

        return newsVO;
    }

    private static final long serialVersionUID = 1L;
}